<template>
	<div class="content">
		<!-- <p style="height: 16rpx;"></p> -->
		<div class="member_box">
			<div class="member">
				<img @click="seeUser(item)" v-for="(item,index) in list" :src="item.avatar?item.avatar:'/static/mr_tx.png'" alt="">
			</div>
		</div>
		<u-popup round="10" mode="bottom" :show="show" @close="show = false">
            <div class="user-msg">
				<img :src="userMsg.avatar?userMsg.avatar:'/static/mr_tx.png'" alt="">
				<div class="msg">
					<p class="name">用户昵称：{{userMsg.nickname}}</p>
					<div>
						<p class="text">用户编号：{{userMsg.id}}</p>
						<p class="text">微信号：{{userMsg.wechatId && userMsg.wechatId!== 'null'?userMsg.wechatId:'暂无~'}}</p>
					</div>
				</div>
			</div>
		</u-popup>
		<p style="height: 16rpx;"></p>
	</div>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	import api from '@/api';
	export default {
		data() {
			return {
				show: false,
				param: {
					pageNo: 1,
					pageSize: 100,
					groupId: 1
				},
				list: [],
				userMsg: {}
			}
		},
		computed: {
			...mapState({
				userId: state => state.user.userId,
			})
		},
		methods: {
			async getGroupUserList() {
				await api.user.sell_group_user(this.param).then(res => {
					if (res.code == 200) {
						this.list = res.data.list
						uni.setNavigationBarTitle({
							title: `群成员（${res.data.total}）`
						});
					}
				})
			},
			async pageChange() {
				await api.user.sell_group_user(this.param).then(res => {
					if (res.code == 200) {
						this.list = this.list.concat(res.data.list)
					}
				})
			},

			seeUser(item) {
				console.log(item)
				this.show = true
				this.userMsg = item
			}

		},
		onLoad(options) {
			this.param.groupId = options.groupId
			this.getGroupUserList()
		},
		onShow() {},
		onReachBottom() {
			this.param.pageNo++
			this.param.pageSize = 24
			this.pageChange()
		}

	}
</script>

<style lang="scss" scoped>
	.content {
		background: #f7f7f7;
		min-height: 100vh;

		.member_box {
			padding: 0 26rpx 26rpx 26rpx;
			background: #fff;
			border-radius: 12rpx;
			margin: 0 30rpx;
			min-height: 100vh;

			.member {
				display: flex;
				flex-wrap: wrap;

				img {
					display: block;
					width: 84rpx;
					height: 84rpx;
					border-radius: 8rpx;
					margin: 18rpx 26rpx 0 0;

					&:nth-child(6n) {
						margin-right: 0;
					}
				}

				.anniu {
					width: 42px;
					height: 42px;
					border-radius: 4px;
					box-sizing: border-box;
					border: 1px dashed #999999;
					background: none;
					margin: 18rpx 0 0 0;
					display: flex;
					align-items: center;
					justify-content: center;

					&::after {
						border: none;
					}
				}
			}

			.more {
				text-align: center;
				font-size: 26rpx;
				margin-top: 30rpx;
				color: #999999;
			}
		}
		.user-msg {
			display: flex;
			padding: 40rpx 30rpx;
			img {
				width: 140rpx;
				height: 140rpx;
				border-radius: 8rpx;
			}
			.msg {
				margin-left: 24rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.name {
					font-weight: 500;
					font-size: 34rpx;
					color: #333333;
				}
				.text {
					font-size: 30rpx;
					color: #999999;
					margin-top: 6rpx;
				}
			}
		}
	}
</style>
